(function ($) {
	'use strict';
	
	var Node_Day = Backbone.View.extend({
		tagName: "div",
		className: "Day Node_Day",
		max:1,
		models:[],
		initialize: function (op) {
			// console.log("###Node_Day initialize");
			this.views = [];
			this.dayInfo = op.dayInfo;
			this.dayDes = op.dayDes;
		},
		distribute: function() {
		
		
			var dayDes = this.dayDes;
//            var dayInfo = this.dayInfo;
			var nodeCover = new $_V.Node_Cover({dayDes:dayDes});
			this.views.push(nodeCover);
		
		// console.log(nodeCover);
		
			var models = this.dayInfo;

            var len=models.length;
			for (var i=0; i<len; i++ ){
				var node = models[i];
				var view = $_G.getView(i,len);
					view.addModel(node);
					if($_G.checkView()){
						this.views.push(view);
					}
					this.models.push(node);
			}


            var photoCount = dayDes.photoCount;

            if(photoCount > len){
                var Node_Load_More = new $_V.Node_Load_More({dayDes:dayDes});
                this.views.push(Node_Load_More);
            }


            console.log(photoCount);



			return this;
		},
		render: function() {
			var views = this.views;
			this.$el.html("");
			for (var v in views){
				this.$el.append(views[v].render().el);
			}
			this.reWidthSize();
			return this;
		},
		reWidthSize:function(){
			var widths = 0;
			var nodes = this.$el.find(".Node").each(function(i) {
						widths += $(this).width();
					});
					
			this.$el.css({
                width: widths
            });
		}
	});
	$_V.Node_Day = Node_Day;
})(jQuery);	